package com.example.petchating.map


import com.badlogic.gdx.maps.tiled.TiledMap
import com.badlogic.gdx.maps.tiled.TmxMapLoader
import ktx.tiled.tileHeight
import ktx.tiled.tileWidth

class MapLoader(
    private val mapFilePath: String
) {
    private val mapLoader = TmxMapLoader()//地图加载器
    val map = mapLoader.load(mapFilePath)

    //地图宽高
    val mapWidth: Float by lazy {
        map.properties["width", Int::class.java] * map.properties["tilewidth", Int::class.java].toFloat()
    }

    val mapHeight: Float by lazy {
        map.properties["height", Int::class.java] * map.properties["tileheight", Int::class.java].toFloat()
    }
    //图块宽高
    val tileWidth = map.tileWidth

    val tileHeight = map.tileHeight

}
